//
//  CMUUIDManager.m
//  writemall
//
//  Created by mac on 2021/9/18.
//  Copyright © 2021 p.write.mall. All rights reserved.
//

#import "CMUUIDManager.h"
#import "CMKeyChain.h"
 
@implementation CMUUIDManager
 
//static NSString * const KEY_IN_KEYCHAIN = @"项目的Bundle ID";
//static NSString * const KEY_UUID = @"项目的BundleID.uuid";

static NSString * const KEY_IN_KEYCHAIN = @"uni.UNI9CB9BD6";
static NSString * const KEY_UUID = @"uni.UNI9CB9BD6.uuid";
//
+(void)saveUUID:(NSString *)uuid
{
    NSMutableDictionary *usernameUuidPairs = [NSMutableDictionary dictionary];
    [usernameUuidPairs setObject:uuid forKey:KEY_UUID];
    [CMKeyChain save:KEY_IN_KEYCHAIN data:usernameUuidPairs];
}
 
+(id)readUUID
{
    NSMutableDictionary *usernameUuidPairs = (NSMutableDictionary *)[CMKeyChain load:KEY_IN_KEYCHAIN];
    return [usernameUuidPairs objectForKey:KEY_UUID];
}
 
+(void)deleteUUID
{
    [CMKeyChain delete:KEY_IN_KEYCHAIN];
}
@end


